package it.traveldream.EJB.entities;

import java.io.Serializable;
import javax.persistence.*;
import java.util.List;


/**
 * The persistent class for the GROUPS database table.
 * 
 */
@Entity
@Table(name="GROUPS")
@NamedQuery(name="Group.findAll", query="SELECT g FROM Group g")
public class Group implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@Column(name="id_gruppo")
	private int idGruppo;

	//bi-directional many-to-many association to User
	@ManyToMany
	@JoinTable(
		name="USER_GROUP"
		, joinColumns={
			@JoinColumn(name="GROUPID", referencedColumnName="GROUPID")
			}
		, inverseJoinColumns={
			@JoinColumn(name="USERID", referencedColumnName="USERID")
			}
		)
	private List<User> users;

	public Group() {
	}

	public int getIdGruppo() {
		return this.idGruppo;
	}

	public void setIdGruppo(int idGruppo) {
		this.idGruppo = idGruppo;
	}

	public List<User> getUsers() {
		return this.users;
	}

	public void setUsers(List<User> users) {
		this.users = users;
	}

}